function Cname() {
    var Name = document.getElementById("Tname").value;
    var regStr = /^[a-zA-Z][a-zA-Z0-9_]{4,15}$/;
    if (Name.length == "") {
        document.getElementById("Rname").style.color = "red";
        document.getElementById("Rname").innerHTML = " <img src='img/error_tip.png'>请输入您的用户名！";
        return false;
    }
    else if (!regStr.test(Name)) {
        document.getElementById("Rname").style.color = "red";
        document.getElementById("Rname").innerHTML = " <img src='img/error_tip.png'>用户名只能由5-16位字母、数字组成";
        return false;
    }
    else {
        document.getElementById("Rname").style.color = "#1e8e04";
        document.getElementById("Rname").innerHTML = " <img src='img/right_tip.png'>该用户名可以使用";
        return true;
    }
}
function Cpwd1() {
    var pwd1 = document.getElementById("Tpwd1").value;
    if (pwd1.length == "") {
        document.getElementById("Rpwd1").style.color = "red";
        document.getElementById("Rpwd1").innerHTML = " <img src='img/error_tip.png'>请输入密码！";
        return false;
    }
    else if (pwd1.length < 6 || pwd1.length > 16) {
        document.getElementById("Rpwd1").style.color = "red";
        document.getElementById("Rpwd1").innerHTML = "<img src='img/error_tip.png'> 密码只能由6-16位字母、数字组成";
        return false;
    }
    else {
        document.getElementById("Rpwd1").style.color = "#1e8e04";
        document.getElementById("Rpwd1").innerHTML = " <img src='img/right_tip.png'>密码通过";
        return true;
    }
}
function Cpwd2() {
    var pwd1 = document.getElementById("Tpwd1").value;
    var pwd2 = document.getElementById("Tpwd2").value;
    if (pwd2.length == "") {
        document.getElementById("Rpwd2").style.color = "red";
        document.getElementById("Rpwd2").innerHTML = " <img src='img/error_tip.png'>请输入密码！";
        return false;
    }
    else if (pwd2.length < 6 || pwd2.length > 16) {
        document.getElementById("Rpwd2").style.color = "red";
        document.getElementById("Rpwd2").innerHTML = " <img src='img/error_tip.png'>密码只能由6-16位字母、数字组成";
        return false;
    }
    else if (pwd2 != pwd1) {
        document.getElementById("Rpwd2").style.color = "red";
        document.getElementById("Rpwd2").innerHTML = " <img src='img/error_tip.png'>请保持和上面密码的一致！";
        return false;
    }
    else {
        document.getElementById("Rpwd2").style.color = "#1e8e04";
        document.getElementById("Rpwd2").innerHTML = " <img src='img/right_tip.png'>验证密码通过";
        return true;
    }
}

function Clevel() {
    var level = document.getElementById("Tlevel").value;
    for (var i = 0; i < level.length; i++) {
        if (level.charAt(i) < "0" || level.charAt(i) > "9") {
            document.getElementById("Rlevel").style.color = "red";
            document.getElementById("Rlevel").innerHTML = " <img src='img/error_tip.png'>等级只能是数字！";
            return false;
        }
    }
    if (level.length == "") {
        document.getElementById("Rlevel").style.color = "red";
        document.getElementById("Rlevel").innerHTML = " <img src='img/error_tip.png'>请输入正确的等级！";
        return false;
    } else {
        document.getElementById("Rlevel").style.color = "#1e8e04";
        document.getElementById("Rlevel").innerHTML = "  <img src='img/right_tip.png'>格式合法";
        return true;
    }
}

function Ccredit() {
    var credit = document.getElementById("Tcredit").value;
    for (var i = 0; i < credit.length; i++) {
        if (credit.charAt(i) < "0" || credit.charAt(i) > "9") {
            document.getElementById("Rlevel").style.color = "red";
            document.getElementById("Rlevel").innerHTML = " <img src='img/error_tip.png'>信誉值只能是数字！";
            return false;
        }
    }
    if (credit.length == "") {
        document.getElementById("Rcredit").style.color = "red";
        document.getElementById("Rcredit").innerHTML = " <img src='img/error_tip.png'>请输入正确的信誉值！";
        return false;
    } else {
        document.getElementById("Rcredit").style.color = "#1e8e04";
        document.getElementById("Rcredit").innerHTML = " <img src='img/right_tip.png'>格式合法";
        return true;
    }
}

function Cemail() {
    var email = document.getElementById("Temail").value;
    var regStr = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[c,o,n,e,t,m]{2,3})+$/;
    if (email.length == "") {
        document.getElementById("Remail").style.color = "red";
        document.getElementById("Remail").innerHTML = " <img src='img/error_tip.png'>请输入您的电子邮箱地址！";
        return false;
    }
    else if (!regStr.test(email)) {
        document.getElementById("Remail").style.color = "red";
        document.getElementById("Remail").innerHTML = " <img src='img/error_tip.png'>请提供合法有效的电子邮箱地址";
        return false;
    }
    else {
        document.getElementById("Remail").style.color = "#1e8e04";
        document.getElementById("Remail").innerHTML = "  <img src='img/right_tip.png'>格式合法";
        return true;
    }
}

function Ctel() {
    var Tel = document.getElementById("Ttel").value;
    for (var i = 0; i < Tel.length; i++) {
        if (Tel.charAt(i) < "0" || Tel.charAt(i) > "9") {
            document.getElementById("Rtel").style.color = "red";
            document.getElementById("Rtel").innerHTML = " <img src='img/error_tip.png'>手机号码只能是11位数字！";
            return false;
        }
    }
    if (Tel.length == "") {
        document.getElementById("Rtel").style.color = "red";
        document.getElementById("Rtel").innerHTML = " <img src='img/error_tip.png'>请输入您的手机号码";
        return false;
    }
    else if (Tel.length != 11) {
        document.getElementById("Rtel").style.color = "red";
        document.getElementById("Rtel").innerHTML = " <img src='img/error_tip.png'>手机号码只能11位，且只能是数字";
        return false;
    }
    else if ((/^(?:13\d|15\d|18[689])-?\d{5}(\d{3}|\*{3})$/.test(Tel))) {
        document.getElementById("Rtel").style.color = "#1e8e04";
        document.getElementById("Rtel").innerHTML = " <img src='img/right_tip.jpg'>格式合法";
        return true;
    }
    else {
        document.getElementById("Rtel").style.color = "red";
        document.getElementById("Rtel").innerHTML = " <img src='img/error_tip.jpg'>这不是手机号码，请重新输入";
        return false;
    }
    {
        document.getElementById("Rtel").style.color = "#1e8e04";
        document.getElementById("Rtel").innerHTML = " <img src='img/right_tip.png'>格式合法";
        return true;
    }
}

function Result() {
    if (Cname() && Cpwd1() && Cpwd2() && Cemail() && Ctel()) {
        return true;
    }
    else {
        alert("您的资料填写错误");
        return false;
    }
}

function ResultUpdate() {
    if (Cpwd1() && Clevel() && Ccredit() && Cemail() && Ctel()) {
        return true;
    }
    else {
        alert("您的资料填写错误");
        return false;
    }
}

function ResultForgot() {
    if (Cname() && Cemail() && Ctel()) {
        return true;
    }
    else {
        alert("您的资料填写错误");
        return false;
    }
}

function ResultForgot1() {
    if (Cpwd1() && Cpwd2()) {
        return true;
    }
    else {
        alert("您的资料填写错误");
        return false;
    }
}